Repository navigation
fix(id-core): correct frames byte-refusal test to the crate oversize semantics (#8354) - #9889
Conversation
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 29 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
The test was wrong; the code follows the crate's documented design. Evidence:
oversize_byte_request_is_refused_permanently) pins exactly this forcheck_bytes: cost = burst + 1 → RequestTooLarge, retry_after_ms None, at t=0 and at a far-future time; the exact-burst control is admitted.check_frame_and_bytes(whatcharge_framecalls) implements the same rule: oversize on either bucket is checked first and returns RequestTooLarge.The failing frames test charged 5 bytes against byte_burst 4 — an over-capacity cost — but expected BudgetExhausted, which the design reserves for a within-capacity cost the bucket momentarily cannot cover (retryable). No code change was needed; production semantics are unchanged.
Fix (test-only): the oversize charge now expects RequestTooLarge with no retry offered, keeping the test's no-spend assertions (no counters recorded; the frame allowance intact, proven by the following 4-byte charge landing exactly {frames: 1, bytes: 4}). A second scenario was added so the test also pins the BudgetExhausted atomicity it was named for: drain the byte bucket with an admitted 4-byte charge, then a within-capacity 1-byte charge is refused BudgetExhausted (retry present) and likewise spends neither the frame token nor the counters.
Verification:
cargo test -p id-core --libin a worktree at origin/main: 427 passed, 0 failed (previously 427 run with this one failure).Closes #8354
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.